package com.ego.coupon.po;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.io.Serializable;

import com.ego.coupon.vo.SkuReductionVo;
import com.ego.coupon.vo.spu.MemberPriceVo;
import lombok.Data;

/**
 * @program: ego
 * @description 商品会员价格
 * @author KamTang
 * @date 2022-11-13 13:17:12
 */
@Data
@TableName("sms_member_price")
public class MemberPrice implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@TableId
	private Long id;
	/**
	 * sku_id
	 */
	private Long skuId;
	/**
	 * 会员等级id
	 */
	private Long memberLevelId;
	/**
	 * 会员等级名
	 */
	private String memberLevelName;
	/**
	 * 会员对应价格
	 */
	private BigDecimal memberPrice;
	/**
	 * 可否叠加其他优惠[0-不可叠加优惠，1-可叠加]
	 */
	private Integer addOther;

	public static MemberPrice build(SkuReductionVo vo, MemberPriceVo price) {
		MemberPrice memberPrice = new MemberPrice();
		memberPrice.setSkuId(vo.getSkuId());
		memberPrice.setMemberLevelId(price.getId());
		memberPrice.setMemberLevelName(price.getName());
		memberPrice.setMemberPrice(price.getPrice());
		memberPrice.setAddOther(1);
		return memberPrice;
	}
}
